package com.example.user.filter;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

public class Cb1_demo implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("filter demo  init");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("do filter start");
        HttpServletRequest res = (HttpServletRequest)servletRequest;
        System.out.println(res.getRequestURI());
        filterChain.doFilter(servletRequest,servletResponse);
        System.out.println("do filter end");
    }

    @Override
    public void destroy() {
        System.out.println("filter demo  destroy");
    }
}
